<template>
  <!-- 必填说明  1.列表参数params  2.参数 url 导出链接  3.是php的还是Java的 4.permissionJson  按钮权限-->
  <div class="block">
    <!-- java导出 -->
    <el-button
      style="margin-left:60px"
      type="primary"
      @click="exfun"
      v-if="$store.state.user.permissionJson.indexOf(permissionJson) !=-1 && type!='php'"
    >导出</el-button>
    <!-- php导出 -->
    <el-button style="margin-left:60px" type="primary" @click="exfun" v-if=" type=='php'">导出</el-button>
  </div>
</template>

<script>
import { exportfile } from "@/api/commjs/exprot";
export default {
  props: {
    params: {
      type: Object,
      default: null
    },
    url: {
      type: String,
      default: null
    },
    type: {
      type: String,
      default: null
    },
    permissionJson: {
      type: String,
      default: null
    }
  },
  name: "",
  data() {
    return {};
  },
  methods: {
    exfun() {
      let type = this.type == "php" ? 1 : 0;
      exportfile(this.url, this.params, type);
    }
  }
};
</script>
<style scoped>
.block {
  display: inline-block;
}
</style>